﻿using Firefly.Framework.Windows.ContentReaders;
using Firefly.Framework.Windows.Forms;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;

namespace Firefly.ContentPipeline.Windows.Forms
{
    [ContentTypeWriter]
    public class ScrollbarContentWriter : ContentTypeWriter<Scrollbar>
    {
        protected override void Write(ContentWriter output, Scrollbar value)
        {
            WriteScrollbar(output, value);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(ScrollbarContentReader).AssemblyQualifiedName;
        }

        internal static void WriteScrollbar(ContentWriter output, Scrollbar value)
        {
            ControlContentWriter.WriteComponent(output, value);
            output.Write((int)value.Orientation);
            output.Write(value.Maximum);
            output.Write(value.Minimum);
            output.Write(value.Value);
        }
    }
}
